#!/usr/bin/env python
#coding=utf-8

from aladin import create_app
from aladin.database import db
from aladin.helpers import format_timestamp
from aladin.ext.uploads import init_upload_app

from app import DEFAULT_MODULES, DEFAULT_APP_NAME, configure_before_handlers
from app.helpers import get_nav_classname, get_social_time

app = create_app("config.cfg", DEFAULT_MODULES, DEFAULT_APP_NAME)
db.init_app(app)
configure_before_handlers(app)
init_upload_app(app)

app.jinja_env.filters['format_timestamp'] = format_timestamp
app.jinja_env.filters['get_nav_classname'] = get_nav_classname
app.jinja_env.filters['get_social_time'] = get_social_time

if __name__ == '__main__':
    app.config.from_pyfile('config.dev.cfg')
    app.run(host='0.0.0.0', debug=True, port=5001)
